/*  (c) 2008 Benjamin Schroeter
 *  This file is part of JaDAL - Just another DSL-Tools Addon Library
 *  and licensed under the New BSD License
 *  For more information please visit http://www.codeplex.com/JaDAL */
using System;

namespace BenjaminSchroeter.Dsl.UserRestrictions
{
    /// <summary>
    /// Possible restrictions for a property.
    /// </summary>
    public enum Restriction
    {
        /// <summary>
        /// The property will be hidden in the properties window.
        /// </summary>
        Hidden = 1,
        /// <summary>
        /// The property will be read-only.
        /// </summary>
        ReadOnly = 2,
        /// <summary>
        /// The property will be displayed as defined int the DSL.
        /// This Restricition has the same effect as removing the Attribut with this definition.
        /// </summary>
        Full = 3
    }

    /// <summary>
    /// This attribute decorates a ModelElement mit special restrictions for 
    /// properties.
    /// 
    /// For each property and each Restriction (can be user defined) can exist one of this attibutes.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
    public class RestrictedPropertyAttribute : Attribute
    {
        /// <summary>
        /// Gets or sets the name of the property.
        /// </summary>
        /// <value>The name of the property.</value>
        public string PropertyName{ get; set;}

        /// <summary>
        /// Gets or sets the restriction for the property.
        /// </summary>
        /// <value>The restriction for the property.</value>
        public Restriction Restriction { get; set;}

        /// <summary>
        /// Gets or sets the restriction mode this setting is used for.
        /// </summary>
        /// <value>The restriction mode this setting is used for.</value>
        public int RestrictionMode { get; set;}

        /// <summary>
        /// Initializes a new instance of the <see cref="RestrictedPropertyAttribute"/> attribute.
        /// </summary>
        /// <param name="restrictionMode">The restriction mode.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="restriction">The restriction.</param>
        public RestrictedPropertyAttribute(int restrictionMode, string propertyName, Restriction restriction)
        {
            this.PropertyName = propertyName;
            this.Restriction = restriction;
            this.RestrictionMode = restrictionMode;
        }
    }
}